
from model import *
DORMNUMBER = 2
UNITNUMBER = 2
ROOMNUMBER = 6


def initdb():
    db.create_all()
    dorm = Dorm(1)
    db.session.add(dorm)
    for j in range(1, UNITNUMBER + 1):
        unit = Unit(j, dorm)
        db.session.add(unit)

        for q in range(1, ROOMNUMBER + 1):
            room = Room(q, unit, 'F')
            db.session.add(room)
            db.session.commit()

    dorm = Dorm(2)
    db.session.add(dorm)
    for j in range(1, UNITNUMBER + 1):
        unit = Unit(j, dorm)
        db.session.add(unit)

        for q in range(1, ROOMNUMBER + 1):
            room = Room(q, unit, 'M')
            db.session.add(room)
            db.session.commit()
        
    
